import * as constants from '../Constants'
import { get, GET_DATACHECK_LIST, GET_INSTANCE_BY_ID } from '../../service/api'

export interface GetDataCheckList {
  type: constants.GetDataCheckList
  payload: Promise<any>
}

export interface GetDataCheckList_PENDING {
  type: constants.GetDataCheckList_PENDING
  payload: Promise<any>
}

export interface GetDataCheckList_FULFILLED {
  type: constants.GetDataCheckList_FULFILLED
  payload: any
}

export interface GetDataCheckList_PAGE {
  type: constants.GetDataCheckList_PAGE
  payload: any
}

export interface RECORD_DataCheck {
  type: constants.RECORD_DataCheck
  payload: Promise<any>
}

export interface RECORD_DataCheck_FULFILLED {
  type: constants.RECORD_DataCheck_FULFILLED
  payload: Promise<any>
}

export type DataCheckAction = GetDataCheckList | 
  GetDataCheckList_FULFILLED | 
  GetDataCheckList_PENDING | 
  GetDataCheckList_PAGE |
  RECORD_DataCheck |
  RECORD_DataCheck_FULFILLED

export function getDataCheckList(param: any): GetDataCheckList {
  return {
    type: constants.GetDataCheckList,
    payload: get(GET_DATACHECK_LIST, param)
  }
}
export function page(page: any): GetDataCheckList_PAGE {
  return {
    type: constants.GetDataCheckList_PAGE,
    payload: page
  }
}
export function recordDetail(param: any): RECORD_DataCheck {
  return {
    type: constants.RECORD_DataCheck,
    payload: get(GET_INSTANCE_BY_ID, param)
  }
}